package com.nbst.service.base.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.nbst.comnutil.NormalResult;
import com.nbst.dao.mapper.mes.BaseConfigMapper;
import com.nbst.model.base.BaseConfig;
import com.nbst.service.base.IBaseConfigService;

/**
 * @ClassName: BaseConfigServiceImpl
 * @Description:基础配置实现类
 * @author King
 * @date 2019年9月6日
 * 
 */
@Service
public class BaseConfigServiceImpl extends BaseServiceImpl<BaseConfig, BaseConfigMapper> implements IBaseConfigService {

	@Override
	public NormalResult findByCondition(Map<String,Object> map, Integer offset, Integer row) {
		return super.findByCondition(map, offset, row);
	}

	@Override
	public NormalResult insertSelective(BaseConfig t) {
		return super.insertSelective(t);
	}

	@Override
	public NormalResult updateByPrimaryKeySelective(BaseConfig t) {
		return super.updateByPrimaryKeySelective(t);
	}

	@Override
	public NormalResult deleteByPrimaryKey(Object t) {
		return super.deleteByPrimaryKey(t);
	}

	@Override
	public boolean isLockStock() {
		Map<String,Object> map = new HashMap<>(8);
		map.put("id", 25);// id为25的内容应为装配单入库后是否锁库
		List<BaseConfig> configs = super.getMapper().findByCondition(map);
		if (configs.size() == 1) {
			String value = configs.get(0).getfValue();
			if ("Y".equals(value)) {
				return true;
			}
		}
		return false;
	}

}
